package com.wang.hrm.feign.client;

import com.wang.doc.CourseDoc;
import com.wang.hrm.feign.fallback.ESFeignClientFallbackFactory;
import com.wang.hrm.query.CourseQuery;
import com.wang.hrm.util.AjaxResult;
import com.wang.hrm.util.PageList;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

//用来调用ES的Feign接口
@FeignClient(value = "es-server",fallbackFactory = ESFeignClientFallbackFactory.class)
public interface ESFeignClient {

    /**
     * 课程上线
     * @param courseDoc
     * @return
     */
    @RequestMapping(value = "/es/onLineCourse",method = RequestMethod.POST)
    AjaxResult onLineCourse(@RequestBody CourseDoc courseDoc);

    /**
     * 课程下线
     * @param courseDoc
     * @return
     */
    @RequestMapping(value = "/es/offLineCourse",method = RequestMethod.POST)
    AjaxResult offLineCourse(@RequestBody CourseDoc courseDoc);

    //查询课程
    @RequestMapping(value = "/es/searchCourse",method = RequestMethod.POST)
    public PageList<CourseDoc> searchCourse(@RequestBody CourseQuery courseQuery);
}
